package com.itheima.filter;


import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter(urlPatterns = "")//配置过滤器要拦截的请求路径（/*表示拦截浏览器的所有请求）
public class DemoFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("DemoFilter 放行前的逻辑..........");
        //放行请求
        filterChain.doFilter(servletRequest,servletResponse);//不写当前行代码停止请求
        System.out.println("DemoFilter 放行后的逻辑............");
    }
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
